﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.Text;
using WebServer.Biz;
using WebServer.Models;

namespace WebServer
{
    // 注意: 使用“重构”菜单上的“重命名”命令，可以同时更改代码、svc 和配置文件中的类名“Feedbacks”。
    // 注意: 为了启动 WCF 测试客户端以测试此服务，请在解决方案资源管理器中选择 Feedbacks.svc 或 Feedbacks.svc.cs，然后开始调试。
     [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class Feedbacks : IFeedbacks
    {
        #region 意见反馈
        /// <summary>
        /// 意见反馈列表
        /// </summary>
        /// <param name="PageSize"></param>
        /// <param name="Page"></param>
        /// <param name="Userid"></param>
        /// <param name="Come"></param>
        /// <param name="Type"></param>
        /// <param name="Text"></param>     
        /// <param name="Order">默认根据时间排序，1-ID，2-用户，3-类型，4，来源</param>
        /// <param name="Desc"></param>
        /// <param name="IsDel"></param>
        /// <returns></returns>
        public List<UFeedback> FeedbackSearch(int PageSize, int Page, int UserID, string Come, string Type, string Text, int Order, bool Desc, int IsDel)
        {
            List<UFeedback> entitys = new List<UFeedback>();

            entitys = FeedbackBiz.FeedbackSearch(PageSize, Page, UserID, Come, Type, Text, Order, Desc, IsDel);
            return entitys;
        }



        /// <summary>
        /// 意见反馈列表总数
        /// </summary>    
        /// <param name="Userid"></param>
        /// <param name="Come"></param>
        /// <param name="Type"></param>
        /// <param name="Text"></param>            
        /// <param name="IsDel"></param>
        /// <returns></returns>
        public int FeedbackCount(int UserID, string Come, string Type, string Text, int IsDel)
        {
            int result = 0;
            result = FeedbackBiz.FeedbackCount(UserID, Come, Type, Text, IsDel);
            return result;
        }


        /// <summary>
        /// 删除意见反馈
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public int DelFeedback(int ID)
        {
            int result = 0;
            result = FeedbackBiz.DelFeedback(ID);
            return result;
        }

        /// <summary>
        /// 新增或者修改意见反馈
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int AddOrUpFeedback(UFeedback model)
        {
            int result = 0;
            model.Text = model.Text == "" ? "" : Common.SpecialKey(model.Text);
            result = FeedbackBiz.AddOrUpFeedback(model);
            return result;
        }

        /// <summary>
        /// 根据ID获取意见反馈
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public UFeedback FeedbackByID(int ID)
        {
            UFeedback entity = new UFeedback();
            entity = FeedbackBiz.FeedbackByID(ID);
            return entity;
        }
        #endregion
    }
}
